#include "detect.h"

int main(int argc, char **argv)
{
    Object yolo_out;
    detect yolo("../yolov3-tiny.cfg", "../yolov3-tiny_final.weights", "../config/camPara.yml");
    VideoCapture cap(0);
    Mat frame, blob;
    while (waitKey(1) < 0)
    {
        cap >> frame;
        yolo_out = yolo.inference(frame); //推理模型得到结果
        if (yolo_out.boxes.size() > 0)
        {
            Point center = (yolo_out.boxes[0].br() + yolo_out.boxes[0].tl()) / 2; //求中心点
            float angle = yolo.cal_angle(center);                                 //求角度
            cout << yolo.classes[yolo_out.classIds[0]] << ": " << angle << endl;
        }
        imshow("hh", frame);
    }
}